<template>
    <div class="containers">
        <div class="container">
            <div class="coentens">
                <el-tabs>
                    <el-tab-pane label="钱包设置">
                        <el-form ref="form" label-width="200px">
                            <el-form-item v-for="(item, index) in dataList" :key="index" :label="index">
                                <el-input v-model="dataList[index].detaileds" placeholder="请输入名称"></el-input>
                                <!-- 修改数字-上线请注释 -->
                                <!-- <el-input v-model="dataList[index].detailed" type="number" placeholder="请输入名称"></el-input> -->
                            </el-form-item>
                        </el-form>
                    </el-tab-pane>
                </el-tabs>
                <el-button el-button type="primary" @click="colckList">确认修改</el-button>
            </div>
        </div>
    </div>
</template>

<script>
export default {
    name: 'wallet',
    data() {
        return {
            dataList: {},
        };
    },


    mounted() {
        this.load()
    },
    methods: {
        load() {
            this.request('admin/wallet/', 'get').then(
                res => {
                    console.log(res, "222")
                    this.dataList = res.data.wallet
                },
                function () {
                    console.log('请求失败处理');
                }
            );
        },
        // 点击修改
        colckList() {
            for (let i in this.dataList) {
                this.dataList[i].detailed = Number(this.dataList[i].detailed)
            }
            this.request('admin/wallet/', 'POST', { wallet: this.dataList }).then(
                res => {
                    if (res.errno == 0) {
                        this.$message.success(res.errmsg);
                    } else {
                        this.$message.error(res.errmsg);
                    }
                },
                function () {
                    console.log('请求失败处理');
                }
            );
        }
    },
};
</script>

<style lang="scss" scoped>
.coentens {
    width: 50%;
}
</style>
